package com.alex.springbootdemo.lock;

import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

/**
 *
 */
public interface LockService {

    <T> T executeWithLock(String key, Callable<T> func);

    <T> T executeWithLockThrows(String key, int waitTime, TimeUnit unit, SupplierThrow<T> supplier) throws Throwable;


    @FunctionalInterface
    interface SupplierThrow<T> {
        T get() throws Throwable;
    }
}
